﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 利用交错级数生成杨辉三角
{
    class Program
    {
        static void Main(string[] args)
        {
            const int N = 10;
            int[][] pascal = new int[N][];
            for (int i = 0; i < N; i++)
                pascal[i] = new int[i + 1];

            pascal[0][0] = 1;
            for(int i=1;i<N;i++)
            {
                pascal[i][0] = 1;
                pascal[i][i] = 1;
                for(int j=1;j<i;j++)
                {
                    pascal[i][j] = pascal[i-1][j - 1]+ pascal[i - 1][j];
                }
            }
            for(int i=0;i<N;i++)
            {
                for(int j=0;j<=i;j++)
                {
                    Console.Write("{0,4}", pascal[i][j]);
                }
                Console.WriteLine();
            }
        }
    }
}
